package com.demo.project_template.controller;

import com.demo.project_template.service.SysRoleService;
import com.demo.project_template.vo.request.sys.SysRoleRequestVO;
import com.demo.project_template.vo.response.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 角色表 前端控制器
 * </p>
 *
 * @author 杨玉龙
 * @since 2024-01-03 20:32:03
 */
@Api(tags = "后台角色模块")
@RestController
@RequestMapping("/sysRole")
public class SysRoleController {
    @Resource
    private SysRoleService sysRoleService;

    @ApiOperation(value = "创建或修改后台角色",notes = "有")
    @PostMapping("/createOrUpdateSysRole")
    public R<?> createOrUpdateSysRole(@RequestBody SysRoleRequestVO sysRoleRequestVO){
        sysRoleService.createOrUpdateSysRole(sysRoleRequestVO);
        return R.success();
    }

    @ApiOperation("查询所有的系统角色")
    @GetMapping("/listSysRole")
    public R<List<?>> listSysRole(){
        return R.success(sysRoleService.list());
    }
}
